


void executor() {
    // signal before task.

    // Execute task.
    // signal after task.
    // Process messages.

}


// Directory protocol :
int owner( Page X );
// Is this page locally declared as invalid ?
bool invalid( Page X );

// Events :
PageArrivedW(X);
// Cache refresh.
PageArrivedR(X);


// Requests from runtime code :
void async_acquire_rw(X) {
    // if invalid :
    // Send async fetch.
    // Else :
    // Trigger page arrival R

    // If not responsible :
    // Send async fetch&resp
    // else :
    // Trigger page arrival W

}


void async_acquire_w(X) {
}


void async_steal () {
    // Choose a random node :

    // Send a steal message.


}

void async_commit () {


}


void on_resp_request() {
    // TODO
    // Check all operations done ( should be ok )
    // transfer responsibility.

}

// Reactions to messages received.
void on_steal() {
    // Respond with a bunch of external tasks.


}


// On invalidate :
void on_invalidate() {
    // Invalide les pages qui sont ciblées.
    // Ack to Owner.
}

void on_commit_ack(X) {
    // Generate event CommitAck(X)

}



// Pipeline TDEC :
// { foreach X : acquire(X) } -> (Acquire Completed for Reading) {schedule(T);} -> (BeginTask) {Check W &complete buffers, invalidatecache if marked }
// -> ( TEnd ) { InPlace commit& mark invalidate req & tdec for available, schedule others } -> ( PageArriveW(X) ) {Commit&Tdec(X) }


// Refresh of dataflow frames ?



